package io.xxx.mario.config;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.baomidou.mybatisplus.core.incrementer.ImadcnIdentifierGenerator;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(ImadcnProperties.class)
public class ImadcnConfig {

    private final ImadcnProperties properties;

    public ImadcnConfig(ImadcnProperties properties) {
        this.properties = properties;
    }

    @Bean
    public IdentifierGenerator identifierGenerator() {
        return new ImadcnIdentifierGenerator(properties.getZookeeper().getServers());
    }
}
